@import './variables.css';

.logo {
  width: 40px;
  height: 40px;
}

.app {
  background-color: var(--background-color);
}

.home {
  display: flex;
  padding: 2rem;
  gap: 2rem;
  height: 100%;
}

.left-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #ccc;
  padding-right: 20px;
  background: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.right-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  max-width: 800px;  /* 限制最大宽度 */
}

.control-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 20px;
}

.crop-control {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

#crop-percentage {
  width: 60px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.upload-section {
  margin-bottom: 20px;
}

.upload-controls {
  display: flex;
  gap: 10px;
  align-items: center;
}

.preview-section {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 10px 0;
}

.preview-item {
  position: relative;
  margin: 0.15rem 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  background-color: white;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: grab;
}

.preview-item.dragover::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background-color: #007bff;
  border-radius: 2px;
  top: -6px;
}

.preview-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: #007bff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-image {
  max-width: 100px;
  max-height: 70px;
  object-fit: contain;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
}

.preview-image:hover {
  transform: scale(1.05);
}

.preview-actions {
  display: flex;
  gap: 10px;
  justify-content: right;
  width: 100%;
}

.btn {
  padding: 0.75rem 1.5rem;
  color: white;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
  font-weight: 600;
}

.btn-primary {
  background-color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-danger {
  background-color: var(--danger-color);
}

.btn-danger:hover {
  background-color: var(--danger-hover);
}

.btn-success {
  background-color: var(--success-color);
}

.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-warning {
  background-color: var(--warning-color);
  color: #000;
}

.btn-warning:hover {
  background-color: var(--warning-hover);
}

.start-button {
  padding: 10px 20px;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.start-button:hover {
  background-color: #218838;
}

.result-section {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.small-preview {
  max-width: 200px;
  max-height: 400px;
  cursor: pointer;
  border: 2px solid #ccc;
  border-radius: 8px;
  margin-bottom: 10px;
}

.full-image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.full-image-modal img {
  max-width: 90%;
  max-height: 90%;
  border: 2px solid white;
  border-radius: 8px;
  object-fit: contain;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #f3f3f3;
  border-top: 4px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.range-slider {
  width: 100%;
  margin: 10px 0;
}

.range-control {
  width: 100%;
  padding: 1rem;
  margin: 10px 0;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.crop-percentage-input {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 10px;
}

.range-number-input {
  width: 60px;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 0.9rem;
  transition: var(--transition);
}

.range-number-input:focus {
  border-color: var(--primary-color);
  outline: none;
  box-shadow: 0 0 0 2px rgba(67, 97, 238, 0.2);
}

.result-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.horizontal-range {
  padding: 1rem;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

.result-wrapper {
  display: flex;
  gap: 1.5rem;
  align-items: stretch;  /* 确保子元素等高 */
  min-height: 400px;
}

.result-content {
  flex: 1;
  background: white;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  padding: 1rem;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;  /* 用于子元素定位 */
}

.vertical-range {
  width: 40px;
  padding: 0;
  background: white;
  border-radius: var(--border-radius);
  position: relative;
  overflow: hidden; /* 防止滑块溢出 */
}

.result-preview {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: var(--transition);
}

.result-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}
